<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddIndexFromTenantIdVersionIdIndexInOrderTaskUpstreamVersionTable extends AbstractMigration
{
    public function up()
    {
        $this->table('order_task_upstream_version')
            ->addIndex(['from_tenant_id', 'version_id'], ['name' => 'idx_from_tenant_version', 'type' => 'normal'])
            ->addIndex(['to_tenant_id', 'version_id'], ['name' => 'idx_to_tenant_version', 'type' => 'normal'])
            ->save();
    }

    public function down()
    {
        $this->table('order_task_upstream_version')
            ->removeIndexByName('idx_from_tenant_version')
            ->removeIndexByName('idx_to_tenant_version')
            ->save();
    }
}
